package com.xrtn.job;

import com.xrtn.bean.TBookingInfo;
import com.xrtn.service.ICommonService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by tu_pei on 2018/3/27.
 */
public class OverBookingListJob {

    @Autowired
    private ICommonService commonService;

    public void work(){
        Map<String,Object> params = new HashMap<>();
        params.put("minute", 5);
        params.put("bookingStatus", 1);
        List<TBookingInfo> bookingList = commonService.selectOverBooking(params);
        for (TBookingInfo bookingInfo : bookingList){
            bookingInfo.setBookingStatus(5);
            bookingInfo.setCancelTime(new Date());
            bookingInfo.setCancelType(3);
            bookingInfo.setBookingDesc("宝宝未按时到店，系统自动取消。");
            commonService.updateBookingInfo(bookingInfo);
        }

    }

}
